package org.zxp.designpattern.factory.abstractfactory;

import org.zxp.designpattern.factory.abstractfactory.animal.Animal;
import org.zxp.designpattern.factory.abstractfactory.enums.AnimalType;
import org.zxp.designpattern.factory.abstractfactory.enums.FactoryType;
import org.zxp.designpattern.factory.abstractfactory.factory.AbstractFactory;
import org.zxp.designpattern.factory.abstractfactory.factory.AnimalFactory;

/**
 * @program: effectiveJava
 * @description:
 * @author: X-Pacific zhang
 * @create: 2019-08-21 11:11
 **/
public class AbstractFactoryTest {
    public static void main(String[] args){
        AbstractFactory eastFactory = AnimalFactory.getFactory(FactoryType.EASTBASE);
        AbstractFactory westFactory = AnimalFactory.getFactory(FactoryType.WESTBASE);

        //从东部工厂获取动物
        Animal fish_east = eastFactory.getAnimal(AnimalType.FISH);
        fish_east.show();
        Animal pig_east = eastFactory.getAnimal(AnimalType.PIG);
        pig_east.show();

        //从西部工厂获取动物
        Animal pig_west = westFactory.getAnimal(AnimalType.PIG);
        pig_west.show();
        Animal chicken_west = westFactory.getAnimal(AnimalType.CHICKEN);
        chicken_west.show();
        Animal fish_west = westFactory.getAnimal(AnimalType.FISH);
        fish_west.show();
    }
}
